﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<%@ include file="/WEB-INF/component/commonCSS.jsp"%>
<style type="text/css">
table
  {
  border-collapse:collapse;
  }
  th{
    font-size:14px;
    font-weight:600;
    color:#00a65a;
    padding-left:40px;
    height:40px; 
  }
  td{
  height:40px; 
  width:13%;
  padding-left:25px;
  }
  .no2{
  background-color:#f7f9fd;      
  }
  .title{
  font-weight:600;
  }
  .score{
  color:#d21804;
  font-weight:600;
  margin-right:5px;
  margin-left:10px;
  }
  .liCheckbox{
  margin-top:5px;
  
  }
</style>
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
<div class="box box-primary" id="more" style="width:110px;height:35px;background-color:#222c32;position:absolute;z-index:9999;left:850px;top:100px;display:none;font-size:12px;border-top-color:#222c32;">
            <div class="box-body home-message" id="moreOp" >
            </div>
        </div>
	<section class="content-header">
		<h1>药品评标</h1>
		<ol class="breadcrumb">
			<li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
			<li class="active"><a href="#">分类采购</a></li>
			<li class="active"><a href="#">药品招标管理</a></li>
			<li class="active"><a href="#">评标管理</a></li>
			<li class="active"><a href="#">药品评标</a></li>
		</ol>
	</section>
	<section class="content">
	 <div class=" box box-success">
	 <form id="form" class="form-horizontal" method="post">          
              <div class="box-header with-border">
                <h3 class="box-title">企业信息</h3>
              </div>
              <div class="box-body">
                    <div class="form-group form-group-xs"  style="margin-top:5px;">
                        <label for="inputTextAlter1" class="col-sm-1 text-right">药品编码：</label>
                        <div class="col-sm-2 text-left">${row.drugCode}</div>
                         <label for="inputTextAlter3"  class="col-sm-2 text-right margintop-xs">通用名：</label>
                        <div  id="orgName" class="col-sm-2 text-left">${row.qualityspecName}</div>
                        <label for="inputTextAlter3"  class="col-sm-2 text-right margintop-xs">剂型：</label>
                        <div  id="orgName" class="col-sm-3 text-left">${row.form}</div>
                    </div>
                    
                    <div class="form-group form-group-xs" style="margin-top:-10px">
                         <label for="inputTextAlter2" class="col-sm-1 text-right">规格：</label>
                        <div id="outstandAmt" class="col-sm-2 text-left"> ${row.spec}</div>
                        <label for="inputTextAlter2"  class="col-sm-2 text-right">转换系数：</label>
                        <div id="outstandAmt" class="col-sm-2 text-left"> ${row.factor}</div>
                         <label for="inputTextAlter2"  class="col-sm-2 text-right">单位：</label>
                        <div id="outstandAmt" class="col-sm-3 text-left"> ${row.unit}</div>
                    </div>
                    
                     <div class="form-group form-group-xs"  style="margin-top:-10px">
                     <label for="inputTextAlter1" class="col-sm-1 text-right">材质：</label>
                     <div id="availableAmt" class="col-sm-2 text-left">${row.materialName}</div>
                     <label for="inputTextAlter1" class="col-sm-2 text-right">生产企业：</label>
                     <div id="availableAmt" class="col-sm-2 text-left">${row.prodCompCode}</div>
                     <label for="inputTextAlter1" class="col-sm-2 text-right">药品资质：</label>
                     <div id="availableAmt" class="col-sm-3 text-left">${row.materialName}</div>
                     </div>  
                     <div class="line" style="margin:10px 0px;"></div>
                     <table>
                       <tr>
                         <th>项目</th>
                         <th colspan="4" style="padding-left:220px;;">主观分指标设置信息</th>
                       </tr>
                       <tr>
                         <td class="title">安全性评价</td>                         
                         <td><label><input class="liCheckbox" type="checkbox"  name="checkbox"></label><span class="score">10分</span>临床安全性优</td>
                         <td><label><input  class="liCheckbox" type="checkbox"  name="checkbox"></label><span class="score">5分</span>临床安全性中</td>
                         <td><label><input  class="liCheckbox" type="checkbox"  name="checkbox"></label><span class="score">0分</span>分临床安全性差</td>
                         <td></td>
                       </tr>
                       <tr class="no2">
                         <td class="title">品牌认同度</td>
                         <td><label><input class="liCheckbox" type="checkbox"  name="checkbox"></label><span class="score">10分</span>品牌认同度优</td>
                         <td><label><input  class="liCheckbox" type="checkbox"  name="checkbox"></label><span class="score">8分</span>品牌认同度良</td>
                         <td><label><input  class="liCheckbox" type="checkbox"  name="checkbox"></label><span class="score">6分</span>品牌认同度一般</td>
                         <td><label><input  class="liCheckbox" type="checkbox"  name="checkbox"></label><span class="score">0分</span>品牌认同度差</td>
                       </tr>
                       <tr>
                         <td class="title">包装质量与方便性</td>
                         <td><label><input  class="liCheckbox" type="checkbox"  name="checkbox"></label><span class="score">10分</span>包装质量与方便性优</td>
                         <td><label><input  class="liCheckbox" type="checkbox"  name="checkbox"></label><span class="score">8分</span>包装质量与方便性良</td>
                         <td><label><input  class="liCheckbox" type="checkbox"  name="checkbox"></label><span class="score">6分</span>包装质量与方便性一般</td>
                         <td><label><input  class="liCheckbox" type="checkbox"  name="checkbox"></label><span class="score">0分</span>包装质量与方便性差</td>
                        </tr>
                       <tr  class="no2">
                         <td class="title">临床疗效评价</td>
                         <td><label><input  class="liCheckbox" type="checkbox"  name="checkbox"></label><span class="score">10分</span>明显高于其他产品</td>
                         <td><label><input  class="liCheckbox" type="checkbox"  name="checkbox"></label><span class="score">5分</span>优于由于其他产品</td>
                         <td><label><input  class="liCheckbox" type="checkbox"  name="checkbox"></label><span class="score">0分</span>明显低于其他产品</td>
                         <td></td>
                       </tr>
                    </table>
                 </div>            
            
            <div class="box-footer text-center">
            <p  class="btn btn-success btn-sm nextDrug"  >下一条</p>
			<label  class="btn btn-danger btn-sm" onclick='javascript:history.go(-1)'>返&nbsp;回</label>
            </div>
           </form>  
        </div>
        
        
		<div class=" box box-success">
			<div class="box-body">
				<div class=" form-inline">
					
                </div>
            </div>
        </div>
     <div class="drug"></div>
      <div class="line" style="margin:10px 0px;"></div>
     <div class="test"></div>   
	<input type="hidden" id="myTags" value="0" />
		<div class=" box box-warning bottongroup">
			<p  class="btn btn-default btn-sm nextDrug"  >下一条</p>
			<label  class="btn btn-default btn-sm" onclick='javascript:history.go(-1)'>返&nbsp;回</label>
		</div>
    </section>
    <%@ include file="/WEB-INF/component/commonJS.jsp"%>
     <script id="drug" type="text/html"> 
	<table style="TABLE-LAYOUT: fixed" border="1" width="100%">
<thead>
			<tr>
<th style="text-algn:center">序号</th>  
<th style="text-algn:center">药品编码</th>   
<th style="text-algn:center">通用名</th>		    
<th style="text-algn:center">剂型</th>
<th style="text-algn:center">规格</th>   
<th style="text-algn:center">转换系数</th>
 <th style="text-algn:center">单位</th>   
 <th style="text-algn:center">材质</th>
 <th style="text-algn:center">生产企业</th>
 <th style="text-algn:center">药品资质</th>  
			</tr>
		</thead>
<tbody>
		<tr>
<td class="number" style="WORD-WRAP:break-word" ></td>
 {{each rows as row i}}
<td style="WORD-WRAP:break-word" >{{row.drugCode}}</td>
<td style="WORD-WRAP:break-word" >{{row.qualityspecName}}</td>
<td style="WORD-WRAP:break-word" >{{row.form}}</td>
<td style="WORD-WRAP:break-word" >{{row.spec}}</td>
<td style="WORD-WRAP:break-word" >{{row.factor}}</td>
<td style="WORD-WRAP:break-word" >{{row.unit}}</td>
<td style="WORD-WRAP:break-word" >{{row.materialName}}</td>
<td style="WORD-WRAP:break-word" ><a href="javascript:$.HN.dialog.opendialog('{{row.prodCompCode}}','生产企业信息','${ctx}/stdCompinfo/toStdCompinfoDetail.html?compId={{row.prodCompCode}}','800px','400px',operResult)">{{row.prodCompName}}</a></td>
<td style="WORD-WRAP:break-word" >{{row.materialName}}</td>

<input type="hidden" id ="projProddrugId" value="{{row.projProddrugId}}"/>
 {{/each}}
		</tr>
	</tbody>
	</table>
	</script>
    <script id="test" type="text/html">
<div class="table-responsive" style="overflow-x:hidden">
	<table style="TABLE-LAYOUT: fixed" border="1" width="100%">
<thead>
			<tr>
 {{each form as title i}}
		          <th>    
			  <div class="row">
		      <div class="col-md-12">
		 			{{title}}       
		  	  </div>
		      </div>
				</th>	
  {{/each}}
			</tr>
		</thead>
	<tbody>
		<tr>
   {{each rows as row i}}
		 <td style="WORD-WRAP:break-word">
  		 {{each row as text j}}
			<div class="row {{j}}">
			<div class="col-md-12">
		   	  {{text.name}}<p class="pull-right"><input type="radio" class="group{{i}}" name="{{text.fatherId}}" value="{{text.id}}_{{text.score}}"/>{{text.score}}分</p>
		    </div>
		    </div>
		   {{/each}}  
	</td>
 {{/each}}
		</tr>
	</tbody>
	</table>
</div>

</script>	
    <script type="text/javascript">
	var page = 1;
	var records = 0;
	var postData = {"rows":1,"page":page};
	var groupSize = 0;
        $(function () {
        	loadDrug(postData);
        	//下一条数据做分页查询 1.验证radio非空 2.可选择性显示提交提示框 
        	$('.nextDrug').bind('click',function(){
        		
            	if(validate()){
            		var myTags = $('#myTags').val();
            		if(myTags=="1"){
    					commitScore();		
            		}
            		if(myTags=="0"){
            			$.HN.message.withoutConfirm('确定要提交评分吗？', '提示信息', '确定').on(
          					function(e) {
          						if (e) {
          							commitScore();
          					    }
          					});
            		}
            	}
        	}) 
        	function validate(){
        		for( var i=0;i<groupSize;i++ ){
        			if($("input[type='radio'].group"+i+":checked").length != 1){
        				$.HN.message.alert("还没勾选完整！", '信息', 'info');
        				return false;
        			}
        		}
        		return true;
        	}
       
        	//下一条 1.提交评分 2.刷新药品 3.清空选项
        	function commitScore(){
          		 //1.提交评分
        	 	var ids = "";
        		$(':input:radio:checked').each(function(){
        			ids+=$(this).val()+',';
        		})
        		ids = ids.substring(0,ids.length-1);
        		var drugId = $("#projProddrugId").val();
        		$.post('${ctx}/bidProjproddrug/commitBidScore.html',
        					{"ids":ids,"drugId":drugId}, function(result) {
        						if (result.success) {
        							//2.刷新药品 3.radio复位
        			        		page++;
        			            	if (page <=records) {
        			            		postData.page=page;
        			            		loadDrug(postData);
        			            		$(':input:radio:checked').each(function(){
        	        	        			$(this).attr("checked",false);
        	        	        		});
        			            	}else{
        			            		$.HN.message.alert("评分完毕", '信息', 'info');
        			            	}
        						} else {
        							$.HN.message.alert("提交失败", '信息', 'error');
        						}
        					}, "json");	
        	}
        	
         	//获取评分指标
        	function loadScore(){
        		  $.post('${ctx}/bidProjproddrug/getBidScoreRule.html',{"projId":"${projId}"}, function(result) {
      						if (result.success) {
      							var test = template('test', result);
      							$('.test').html(test);
      							groupSize = result.rows.length;
      						} else {
      							$.HN.message.alert("数据获取失败", '信息', 'error');
      						}
      					}, "json");	
        	}
         	
         	
        	
        	// 加载药品
        	function loadDrug(postData){
        		  $.post('${ctx}/bidProjproddrug/getBidProjproddrug.html?projId=${projId}',postData,
        				  function(result) {
        						if (result.success) {
        							if(result.records>0){
        								if(result.rows.length>0){
            								var test = template('drug', result);
                							$('.drug').html(test);
                							$('.number').html("<center  style='color:red;font-size:16px;'>"+page+"</center>");
                							records=result.records;
                							var tr =$.trim($('.content').find('.test').html());
               								if(tr=="" || tr==null ){//如果评分div为空，则加载评分div
               									loadScore();
               								}
            							}else{
            								$.HN.message.alert("已完成评分", '信息', 'info');
            							}
        							}else{
        								$.HN.message.alert("暂无需要评分的药品", '信息', 'info');
        							}
        						} else {
        							$.HN.message.alert("数据获取失败", '信息', 'error');
        						}
        					}, "json");	
        	}

        });
    	function operResult(val){
		    }
    </script>
    
</body>
</html>
